At present, in order to obtain a clear image when taking a photograph, a PTZ (Pan/Tilt/Zoom) camera, commonly referred to as an omni-directional camera with a cradle head, is generally required to automatically focus on an object to be photographed so that the focus of a lens of the PTZ camera falls on an image sensor. The image sensor is for example a CMOS (Complementary Metal Oxide Semiconductor) image sensor. The focus refers to a point where parallel light beams converge after refracted by a lens.
In the prior art, in order to realize automatic focusing, a PTZ camera is required to adjust the position of a focus motor in a lens for several times; then evaluate and analyze the clarity of an object to be photographed at various positions using a clarity evaluation function to obtain clarity values corresponding to the various positions; search various positions back and forth to obtain a position corresponding to the largest clarity value using a blind hill climbing search algorithm; and finally move the focus motor to this position, thus completing the automatic focusing.
However, in such an automatic focusing method, the focusing speed is slow and fast focusing cannot be achieved.